extends Card

func init():
	att.cry = 0 #卡牌的费用
	att.atk = 0
	att.maxHp = 0
	lv = 5 #卡牌的等级  2蓝色 3紫色 4黄色
	type = TYPE.CREATURE #卡牌类型为随从
	camp = "m_all" #阵营 
	name = "觉醒的余烬" #卡牌名称
	tab = "恶魔 野兽"
	dec = "[color=#EBC552]无伤[/color]；魔免；[color=#EBC552]魔法生物[/color]；\n本生物存活时，沉默对方手牌、场上的随从，并移除标签。\n亡语：将“无火的余烬”放入牌库。"
	tips = ["[color=#EBC552]无伤[/color]：目测能击杀对方时免受反击伤害。\n“[color=#E0A761]就这？我能无伤过！[/color]”","[color=#EBC552]魔法生物[/color]：本卡的标签同时视为“火”、“风”、“水”、“冰”、“土”、“空气”、“光”、“暗”。","“[color=#E0A761]什么花里胡哨的？砍，下一个！砍，下一个！[/color]”"]
	isTrig = true
	isUsable = false
	isHalo = true 
#绑定信号来触发效果
var lvpower = 0
func _connect():
	sys.bgm.stop()
	sys.playSeMp3(dir+"/monster.mp3")
	connect("onHurtStart",self,"e1")
	sys.scene.connect("onCardUse",self,"e2")
	addSkill("k_moMian")
	addSkillObj(Kl.new())
	att.atk += lvpower
	att.maxHp += lvpower
	for i in sys.scene.getAllCard(getHero(),1,false):
		if i != null && i.getTeam() != getTeam() && i.type == TYPE.CREATURE :
			i.silence()
			i.setTab("")
	yield(sys.get_tree().create_timer(3.8),"timeout")
	sys.bgm.play()
	
class Kl:
	extends "res://ex/skill/k_wangYu/k_wangYu.gd"
	func _init():
		._init()
		copyInfo("k_wangYu")
	
	func _trigger():
		var c = card.getHero().newCard("c_wuhuo_bonefire")
		card.getHero().lib.addCard(c)

func e1(c1:AtkInfo):
	if c1.hitCard != self || c1.atkCard.type != TYPE.CREATURE || att.atk < c1.atkCard.att.hp ||self.hasSkill("k_siChu") == false :return
	if self.hasSkill("k_siChu") == true && c1.atkCard.hasSkill("k_shenDun") == false && att.atk > 0:
		animTrig()
		c1.atkVal = 0
	else:
		if c1.atkCard.hasSkill("k_shenDun") == false && c1.atkCard.dec.find("伤害变") <= -1 && c1.atkCard.dec.find("只受到") <= -1 && c1.atkVal > 0 && c1.atkCard.getSkill("k_stoneskin") == null:
			animTrig()
			c1.atkVal = 0
		if c1.atkCard.hasSkill("k_shenDun") == false && c1.atkCard.att.hp <= 1 :
			animTrig()
			c1.atkVal = 0

func e2(i):
	if i != null && i.getTeam() != getTeam() && i.type == TYPE.CREATURE :
		i.silence()
		i.setTab("")